class LogsController < ApplicationController
  
  hobo_model_controller
  
  def create
    @this = Log.create(params[:log])
    respond_to do |format|
      format.html { redirect_to log_path(@this)}
      format.js do
        render :update do |page|
          page.insert_html :bottom, 'log_holder', "<div class='log_entry' id='log_entry_#{@this.id}'><span class='log_header'>On #{Hobo::Dryml.render_tag @template, "show", {:obj => @this, :attr => "created_at"}}, #{Hobo::Dryml.render_tag @template, "show", {:obj => @this, :attr => "user"}} says:</span><br /><div class='log_content'>#{Hobo::Dryml.render_tag @template, "show", {:obj => @this, :attr => "comment"}}</div><br />#{Hobo::Dryml.render_tag @template, "delete_button", {:obj => @this, :update => "log_part"}}</div>"
          page.visual_effect "highlight", "log_entry_#{@this.id}"
          page.visual_effect "fade", "ajax_progress"
        end
      end
    end
  end

  def destroy
    @this = Log.find(params[:id])
    id = @this.id
    @this.destroy
    respond_to do |format|
      format.html { redirect_to logs_path}
      format.js do
        render :update do |page|
          page.visual_effect "shrink", "log_entry_#{id}"
        end
      end
    end
  end
  
end
